package com.qf.openapi.web.master.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;

@Data  // 生成熟悉的setter和getter方法 ， 生成toString 方法
@AllArgsConstructor  // 生成全参构造函数
@NoArgsConstructor   // 生成无参构造函数
public class User implements Serializable {

    private Integer id;

    private String name;

    private String password;

    private String sex;

    @JsonFormat(pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date birthday;

    @JsonFormat(pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date registTime;

    private String auth;

    private String photopath;

    public User(String name, String sex, Date birthday, Date registTime) {
        this.name = name;
        this.sex = sex;
        this.birthday = birthday;
        this.registTime = registTime;
    }

    public String toCsvString(){
       return id+","+name+","+sex+","+birthday;
    }
}
